import time
from datetime import timedelta

from utils.file_util import FileUtil
from sbs.sbs_convertor import SbsConvertor


def main():
    print("转换 .sbs 文件为 .json 文件")
    sbs_file = "./data/PredefinedTypesC++.sbs"
    json_file = "./temp/PredefinedTypesC++.json"

    convertor = SbsConvertor(sbs_file)
    json = convertor.to_json()
    # 写入 .json 文件
    FileUtil.write_json_file(json_file, json)
    print(f"已将 {sbs_file} 转换为 {json_file}")


if __name__ == "__main__":
    start_time = time.time()
    main()
    end_time = time.time()
    print(timedelta(seconds=end_time - start_time))
